<?php

declare(strict_types=1);

namespace App\Request\Admin;

use App\Constants\Model\CertificationCompanyApply;
use Hyperf\Validation\Request\FormRequest;
use Hyperf\Validation\Rule;

class CertificationCompanyApplyIndexRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     */
    public function authorize(): bool
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     */
    public function rules(): array
    {
        return [
            'status' => [
                'required',
                Rule::in([CertificationCompanyApply::STATUS_PENDING, CertificationCompanyApply::STATUS_ALLOW,CertificationCompanyApply::STATUS_NOT_ALLOW])
            ],
            'keywords' => 'sometimes',
            'province' => 'sometimes',
            'cooperative_id' => 'sometimes',
            'city' => 'sometimes',
            'page' => 'required',
            'perPage' => 'required'
        ];
    }
}
